﻿/* ****************************************************************************
 *
 * Copyright (c) Francesco Abbruzzese. All rights reserved.
 * francesco@dotnet-programming.com
 * http://www.dotnet-programming.com/
 * 
 * This software is subject to a dual license model 
 * included in the license.txt file of this distribution.
 * 
 * You must not remove this notice, or any other, from this software.
 *
 * ***************************************************************************/
using System;
using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher;

namespace BindToolkit.Behaviors
{
    public class ChangeStatusCodeTo200ErrorHandler:IErrorHandler
    {

        
        public ChangeStatusCodeTo200ErrorHandler()
        {
            
        }
        public bool HandleError(Exception error)
        {
            return false;
        }

        public void ProvideFault(Exception error, MessageVersion version, ref Message fault)
        {
            fault.Properties[HttpResponseMessageProperty.Name] = 
                new HttpResponseMessageProperty
                    {
                        StatusCode = System.Net.HttpStatusCode.OK
                    };
        }
    }
}
